﻿@namespace Masa.Blazor.Popup.Components
@inherits AlertingPopupComponentBase
@using Masa.Blazor.Presets

<MDialog Value="Visible"
         Width="420"
         Persistent="true"
         ContentClass="m-popup-confirm"
         @attributes="@Attributes">
    <MCard>
        @if (!string.IsNullOrEmpty(Title))
        {
            <MCardTitle Class="@TitleClass"  Style="@($"{(ComputedContent is null ? "font-size: 1rem;" : "")} {TitleStyle}")">
                @if (!string.IsNullOrEmpty(ComputedIcon))
                {
                    <MIcon Color="@ComputedIconColor" Class="mr-2">@ComputedIcon</MIcon>
                }
                @Title
            </MCardTitle>
        }

        @if (ComputedContent is not null)
        {
            <MCardText Class="@($"pb-0 {ContentClass}")" Style="@ContentStyle">
                @ComputedContent
            </MCardText>
        }

        <MCardActions Class="@ActionsClass" Style="@($"justify-content:flex-end; {ActionsStyle}")">
            <ModalButton Props="ComputedCancelButtonProps"
                         Disabled="_okLoading"
                         OnClick="HandleOnCancel">
                @CancelText
            </ModalButton>
            <ModalButton Props="ComputedOkButtonProps"
                         Disabled="_okLoading"
                         Loading="_okLoading"
                         OnClick="HandleOnOk">
                @OkText
            </ModalButton>
        </MCardActions>
    </MCard>
</MDialog>
